import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

//创建路由表
const routes = [
    {
        path : '/',
        redirect: '/index'
    },
    {
        path : '/index',
        component: resolve=>require(['Pages/home'],resolve)//路由懒加载
    },
    {
        path : '/login',
        component: resolve=>require(['Pages/login'],resolve)
    },
    {
        path : '/gwc',
        component: resolve=>require(['Pages/gwc'],resolve),
        meta:{
            requireAuth:true,//当有这个字段的时候，我们就认为他这个路由页面是要有登录权限的
        }
    }
]

//创建route实例
const router = new VueRouter ({
    
    routes,//路由表,必须的
    mode: 'history',//history路由
    // modules: {},//可以不写

})




export default router